package com.coupon.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author :wn
 * @program : coupon
 * @descript : pojo
 * @create :2020-12-28 09:25
 */
//实现序列化接口（前后端通信时，对于实体类数据的传输都是序列化数据）

public class User implements Serializable {
    private static final long serialVersionUID = 8778991687643274515L;
    //针对会员设计的实体类；

    private Integer id;
    private String name;
    private String phone;
    private Date birth;

    //如果从数据库中查询的目标值转换为json的时候，默认使用时间戳
    //时间戳1970年1月份到值的
    //Jackson使用@JsonFormat的注解快速实现格式化处理

    @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date regTime;

    public User() {
    }

    public User(Integer id, String name, String phone, Date birth, Date regTime) {
        this.id = id;
        this.name = name;
        this.phone = phone;
        this.birth = birth;
        this.regTime = regTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public Date getRegTime() {
        return regTime;
    }

    public void setRegTime(Date regTime) {
        this.regTime = regTime;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", birth=" + birth +
                ", regTime=" + regTime +
                '}';
    }
}
